<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>

<body>
  <!-- reg.exec(str)  匹配字符串 返回第一次匹配的项到数组中 -->
  <!-- 关系型数组  哈希数组 -->
  <script>
    var reg = /a/g
    var str = "sdfasdfasdfasdfasdfasdf"
    // str.match(reg)//["a","a","a","a"]

    console.log(reg.exec(str)) //[0:"a",index: 3,input:"sdfasdfasdfasdfasdfasdf"]
    // index:3  第一次匹配到的位置
    //input  匹配源 
      // test  exec 正则
  </script>
</body>

</html>